﻿using System;
using System.ComponentModel.DataAnnotations;
using Epam.PeopleInterfaces;

namespace Epam.PeopleModel
{
    public class NewsEntity:INewsEntity
    {
        public Guid Id { get; private set; }

        [Required]
        [RegularExpression("[^<>/]{1,1000}", ErrorMessage = "Text has simbols <>/")]
        public string Text { get; private set; }

        [Required]
        [RegularExpression("[^<>/]{1,50}", ErrorMessage = "Text has simbols <>/")]
        public string Title { get; private set; }

        [Required]
        public DateTime Created { get; private set; }

        public NewsEntity()
        {
            Id = Guid.Empty;
            Text = string.Empty;
            Title = string.Empty;
            Created = DateTime.Now;
        }

        public NewsEntity(Guid id,string text,string title,DateTime created)
        {
            Id = id;
            Text = text;
            Title = title;
            Created = created;
        }
    }
}
